<?php

$content = "";

if (isset($_GET['searchcity'])) {
	//$content = file_get_contents('http://api.geonames.org/searchJSON?name_equals='.urlencode($_GET['searchcity']).'&featureClass=P&maxRows=5&username=bobcobb');
	$content = file_get_contents('../geonames_kalmar.txt');
}

/*
 * else
 if (isset($_GET['searchWiki'])) {
 //$content = 	file_get_contents('http://api.geonames.org/findNearbyPlaceNameJSON?q='.$_GET['searchWiki'].'&maxRows=5&username=bobcobb');
 $content = file_get_contents('../geonames_kalmar.txt');
 }
 */

elseif (isset($_GET['weather'])) {
	$qString = $_GET['weather'];
	//$content = simplexml_load_file("http://www.yr.no/place/$qString/forecast.xml");
	$content = simplexml_load_file('../temp/forecast.xml');
	$content = json_encode($content);

	//kodar av...

} else {
	echo("annars");
}

echo($content);
